/*
 * @Author: jares
 * @Date: 2024-02-28 19:33:43
 * @LastEditors: jares
 * @LastEditTime: 2024-02-28 19:36:44
 * @Description:
 *
 * Copyright (c) 2024 by jares, All Rights Reserved.
 */
/**
 * @description: 区间随机数，包括最大值
 * @param {*} min 最小值
 * @param {*} max 最大值
 * @return {*}
 */
export const random = (min = 0, max = 10) => {
	let num = Math.floor(Math.random() * (max - min + 1)) + min
	return num
}
/**
 * @description: 16进制颜色转rgb
 * @param {*} hex
 * @return {*}
 */
export const hexToRgb = (hex) => {
	// Remove "#" symbol from the beginning of the string
	hex = hex.replace('#', '')
	// Convert each pair of characters to decimal values for red, green, and blue
	var red = parseInt(hex[0] + hex[1], 16)
	var green = parseInt(hex[2] + hex[3], 16)
	var blue = parseInt(hex[4] + hex[5], 16)

	return [red, green, blue]
}
